Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ncm-afsclt: fix handling of size AUTOMATIC #816

Merged
merged 18 commits into from
Jul 18, 2016
Merged

Conversation

jouvin
Copy link
Contributor

@jouvin jouvin commented Jul 15, 2016

Fixes #815.

@jouvin jouvin added this to the 16.6 milestone Jul 15, 2016
@jouvin jouvin self-assigned this Jul 15, 2016
@jouvin
Copy link
Contributor Author

jouvin commented Jul 15, 2016

I'll try to add a unit test. This is one weakness of this configuration module: there is basically no unit test.

@jrha
Copy link
Member

jrha commented Jul 15, 2016

That and many sites have stopped using AFS.

@jouvin
Copy link
Contributor Author

jouvin commented Jul 15, 2016

Unit tests added for test configurations. Uncovered a few potential issues, in particular if the initial cacheinfo file was empty.

$afs_cacheinfo_fh->cancel();
if ( "$afs_cacheinfo_fh" =~ m;^([^:]+):([^:]+):(\d+)$; ) {
my $afs_cacheinfo_fh = CAF::FileReader->new( $AFS_CACHEINFO, log => $self );
$self->debug(2, "$AFS_CACHEINFO current contents: >>>$afs_cacheinfo_fh<<<");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only in else block? (and in that case, maybe in the error message)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact, I realized that my mod was wrong because if was no longer possible to override value in cacheinfo by the Quattor configuration. cacheinfo should only be used as default values. fixed.

@stdweird
Copy link
Member

some minor remarks, LGTM otherwise

@jouvin
Copy link
Contributor Author

jouvin commented Jul 15, 2016

@stdweird thanks as usual for the remarks. I'll address them tomorrow. Most of them in fact apply to the original code and its last modification in december. I tried to address an urgent problem but didn't attempt to fix all the possible ones. I'll also try to improve a little bit the unit tests.

@jouvin
Copy link
Contributor Author

jouvin commented Jul 16, 2016

Should be ok now. Remarks addresssed. Unit tests improved. cacheinfo values used only as default values.

@jouvin
Copy link
Contributor Author

jouvin commented Jul 16, 2016

@ajf8 you may want to have a look and to check that this doesn't break anything for you, compared to the last modifications you committed in December 2015.

"afs_mount" ? string # AFS mount point (e.g. /afs)
"cachemount" ? string # AFS cache location (/usr/vice/etc/cache)
"cachesize" ? string # AFS cache size in kB
"enabled" : string with match (SELF, 'yes|no') # Shall AFS client be active ?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use legacy_binary_affirmation_string instead.

@stdweird
Copy link
Member

@jouvin thanks for the further cleanup.

$self->debug(1, "AFS mount point not defined: using default ($AFS_MOUNTPOINT_DEF)");
$file_afsmount = $AFS_MOUNTPOINT_DEF;
}
if ( "$new_cache" ne "$file_cache" ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with this check, the AFS_CACHEINIFO is only updated is file_cache is modified, nit file_afsmount or file_cache_mount
i would always write the file, and with the close returns a change in content, do the block below.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

@jouvin
Copy link
Contributor Author

jouvin commented Jul 17, 2016

As for me, ready for merging! @stdweird any other remark?!

my $thiscell_fh = CAF::FileWriter->new( $THISCELL, log => $self );
print $thiscell_fh "$afscell\n";
print $thiscell_fh $config->{thiscell}."\n";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's no need for the stirng concat, "$config->{thiscell}\n" should also work, now that $config is a hashref.

@stdweird
Copy link
Member

@jouvin LGTM (and 👍 for further cleanup and tests)
@jrha not sure if we should wait for feedback from @ajf8 , esp if this is for 16.6.

@jouvin
Copy link
Contributor Author

jouvin commented Jul 17, 2016

@ajf8 feedback would be great but I really think I introduced no feature changes but just fixed things that were addressing just the MS way of configuring AFS but had some flaws due to the lack of unit testing (the main change introduced by this PR!).

"afs_mount" ? string # AFS mount point (e.g. /afs)
"cachemount" ? string # AFS cache location (/usr/vice/etc/cache)
"cachesize" ? string # AFS cache size in kB
"enabled" : legacy_binary_affirmation_string # Shall AFS client be active ?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO this is a retrograde step for readability. I now need to locate this type defined in some other file before I can understand how to populate this mandatory field, which has no default. legacy_yes_or_no_string would be more intuitive.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tend to agree... I was thinking the same thing when doing the modification suggested by @stdweird ...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to open an issue to change. This is work done in quattor/template-library-core#111 and #749; but renaming the type should be very trivial.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO it would be better to make the effort to change the type to boolean instead of renaming the legacy type.

@ajf8
Copy link
Contributor

ajf8 commented Jul 18, 2016

Thanks for the improvements @jouvin and sorry about the break. I think this module needed some work, hopefully I got some of it done, but it looks much better now especially with the unit tests.

Please feel free to merge, I will test it sometime and submit a new pull request if anything is needed.

@stdweird
Copy link
Member

@ajf8 thanks for the feedback

@stdweird stdweird merged commit e57244a into quattor:master Jul 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants